package com.kgc.scd.controller;

import com.kgc.scd.annotation.RequestPermission;
import com.kgc.scd.annotation.RequestUser;
import com.kgc.scd.bean.Product;
import com.kgc.scd.service.GuessProductsService;
import com.kgc.scd.util.RequestResult;
import com.kgc.scd.util.UserAnno;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created On : 2022/6/13.
 * <p>
 * Author     : 98730
 * <p>
 * Description: 猜你喜欢操作入口
 */
@RestController
@Slf4j
@Api(tags = "16、猜你喜欢操作入口")
public class GuessProductsController {

    @Autowired
    private GuessProductsService guessProductsService;

    /**
     * @author : 98730
     * @date   : 2022/6/13
     * @param  : [com.kgc.scd.util.UserAnno]
     * @return : com.kgc.scd.util.RequestResult<java.util.List<com.kgc.scd.bean.Product>>
     * @description : 猜你喜欢
     */
    @PostMapping("/guessYouLikeFeign")
    @ApiOperation(value = "猜你喜欢",notes = "根据用户收藏商品类型，随机选取五个商品展示")

    @ApiResponses({
            @ApiResponse(code = 200, message = "SUCCESS"),
            @ApiResponse(code = 500, message = "FAIL")
    })
    public RequestResult<List<Product>> guessYouLike(@RequestHeader(defaultValue = "no") String token){
        return guessProductsService.guessYouLike(token);
    }
}
